/**
 * Created by Administrator on 2018/7/6 0006.
 */
var JPlaceHolder = {
    _check: function() {
        return "placeholder" in document.createElement("input")
    },
    init: function() {
        this._check() || this.fix()
    },
    fix: function() {
        $(':input[type="text"][placeholder]').each(function(t, i) {
            var e = $(this),
                n = e.attr("placeholder"),
                s = e.css("padding-left"),
                o = e.css("padding-top"),
                a = e.css("color"),
                d = e.css("font-size"),
                c = e.outerWidth(),
                r = $('<div id="wrap_ipt_text_' + t + '" style="width: ' + c + 'px;position: relative;"></div>');
            e.wrap(r);
            var u = $("<div>" + n + "</div>").css({
                position: "absolute",
                top: o,
                left: s,
                "font-size": d,
                color: a
            });
            $("#wrap_ipt_text_" + t).append(u), e.focusin(function(t) {
                u.hide()
            }).focusout(function(t) {
                e.val() || u.show()
            })
        }), $("textarea[placeholder]").each(function(t, i) {
            var e = $(this),
                n = e.attr("placeholder"),
                s = e.css("padding-left"),
                o = e.css("padding-top"),
                a = e.css("color"),
                d = e.css("font-size"),
                c = e.outerWidth(),
                r = $('<div id="wrap_ipt_textarea_' + t + '" style="width: ' + c + 'px;position: relative;"></div>');
            e.wrap(r);
            var u = $("<div>" + n + "</div>").css({
                position: "absolute",
                top: o,
                left: s,
                "font-size": d,
                color: a
            });
            $("#wrap_ipt_textarea_" + t).append(u), e.focusin(function(t) {
                u.hide()
            }).focusout(function(t) {
                e.val() || u.show()
            })
        }), $(':input[type="password"][placeholder]').each(function(t, i) {
            var e = $(this),
                n = e.attr("placeholder"),
                s = e.css("padding-left"),
                o = e.css("padding-top"),
                a = e.css("color"),
                d = e.css("font-size"),
                c = e.outerWidth(),
                r = $('<div id="wrap_ipt_password_' + t + '" style="width: ' + c + 'px;position: relative;"></div>');
            e.wrap(r);
            var u = $("<div>" + n + "</div>").css({
                position: "absolute",
                top: o,
                left: s,
                "font-size": d,
                color: a
            });
            $("#wrap_ipt_password_" + t).append(u), $(i).on("focus", function() {
                u.hide()
            }), $(i).on("blur", function() {
                $(this).val() || u.show()
            })
        })
    }
};
$(function() {}), $(function() {
    $(".separate-num-pre-four").each(function(t, i) {
        $(i).text(function() {
            for(var t = $(this).text().toString().split(""), i = [], e = 0; e < t.length; e++) 0 != e && e % 4 == 0 && i.push(" "), i.push(t[e]);
            return i.join("")
        })
    }), $(".mobile-number").each(function(t, i) {
        $(i).text(function() {
            for(var t = $(this).text().toString().split(""), i = [], e = 0; e < t.length; e++) 3 != e && 7 != e || i.push(" "), i.push(t[e]);
            return i.join("")
        })
    })
}), $(function() {
    var t = $("#mask"),
        i = $("#buffer");
    if(t.length || (t = $('<div id="mask"></div>'), $("body").prepend(t)), !i.length) {
        i = $('<img id="buffer" src="images/buffer.gif">'), $("body").prepend(i);
        var e = 66,
            n = 66;
        i.css({
            top: ($(window).height() - n) / 2,
            left: ($(window).width() - e) / 2
        })
    }
    i.on("load", function() {
        $(this).bind("ajaxSend", function() {
            $(this).show()
        }).ajaxComplete(function() {
            $(this).hide()
        })
    }), $.extend({
        showMask: function(t) {
            return $("#mask").show(), t && t.callback && t.callback(), this
        },
        hideMask: function(t) {
            return $("#mask").hide(), $("#buffer").hide(), t && t.callback && t.callback(), this
        },
        showBuffer: function(t) {
            return $("#buffer").show(), t && t.callback && t.callback(), this
        },
        hideBuffer: function(t) {
            return $("#buffer").hide(), t && t.callback && t.callback(), this
        },
        showUploadProgress: function(t) {
            var i = $("#uprocbar");
            if(!i.length) {
                i = $('<div class="uprocbar f-cb ui-dialog" id="uprocbar"> <div class="already"></div></div>'), $("body").prepend(i);
                var e = parseInt(i.css("width")),
                    n = parseInt(i.css("height")),
                    s = $(window).width(),
                    o = $(window).height();
                i.css({
                    top: (o - n) / 2,
                    left: (s - e) / 2
                }), i.find(".already").css("width", "0%")
            }
            t < 100 ? i.show().find(".already").css("width", t + "%") : i.hide().find(".already").css("width", "0%")
        }
    })
}), $(function() {
    var t = $("#global-prompt");
    t.length || (t = $('<div class="global-prompt" id="global-prompt"></div>'), $("body").prepend(t));
    var i;
    $.extend({
        prompt: function(e, n, s) {
            t.text(e), t.trigger("open");
            var o = n || 2e3;
            "number" == typeof i && clearTimeout(i), i = setTimeout(function() {
                t.hide(), s && s()
            }, o)
        }
    })
}), $(function() {
    function t() {
        i = $(window).width(), e = $(window).height(), $(".ui-dialog").each(function(t, i) {
            "none" != $(this).css("display") && $(this).trigger("open")
        })
    }
    var i = $(window).width(),
        e = $(window).height();
    $(".ui-dialog").bind("open", function() {
        var t = parseInt($(this).css("width")),
            n = parseInt($(this).css("height"));
        $(this).css({
            left: (i - t) / 2 + "px",
            top: 2 * (e - n) / 5 + "px"
        }), $(this).show()
    }), $("#global-prompt").bind("open", function() {
        var t = parseInt($(this).css("width")),
            n = parseInt($(this).css("height"));
        $(this).css({
            left: (i - t) / 2 + "px",
            top: 2 * (e - n) / 5 + "px"
        }), $(this).show()
    }), $(".ui-dialog").bind("show", function() {
        var t = parseInt($(this).css("width")),
            n = parseInt($(this).css("height"));
        $(this).css({
            left: (i - t) / 2 + "px",
            top: 2 * (e - n) / 5 + "px"
        }), $(this).show()
    }), $(".ui-dialog").bind("close", function() {
        $(this).hide(), $.hideMask && $.hideMask()
    }), $(".ui-dialog").find(".close, .cancel").on("click", function() {
        $(".ui-dialog").trigger("close")
    });
    var n;
    $(window).on("resize", function() {
        clearTimeout(n), n = setTimeout(t, 50)
    })
}), $(function() {
    $(".hbtbuser").each(function(t, i) {
        $(this).wrap('<div class="f-pr f-ib wrap-hb-tbuser"></div>'), $(this).after($('<div class="hbstatustips f-usn">璇ヤ拱鎵嬪凡寮€閫氳姳鍛楋紝濡傛湁闂鑱旂郴<span>鍦ㄧ嚎瀹㈡湇</span>鏌ヨ</div>'));
        var e;
        $(this).on("mouseenter", function(t) {
            e && clearTimeout(e), $(this).nextAll(".hbstatustips").show()
        }), $(this).on("mouseleave", function(t) {
            var i = this;
            e = setTimeout(function() {
                $(i).nextAll(".hbstatustips").hide()
            }, 1200)
        }), $(this).nextAll(".hbstatustips").on("mouseenter", function(t) {
            e && clearTimeout(e)
        }).on("mouseleave", function(t) {
            $(this).hide()
        })
    })
}), ! function() {
    window.gw_hidden = window.gw_state = window.gw_visibilityChange = "", "undefined" != typeof document.hidden ? (gw_hidden = "hidden", gw_visibilityChange = "visibilitychange", gw_state = "visibilityState") : "undefined" != typeof document.mozHidden ? (gw_hidden = "mozHidden", gw_visibilityChange = "mozvisibilitychange", gw_state = "mozVisibilityState") : "undefined" != typeof document.msHidden ? (gw_hidden = "msHidden", gw_visibilityChange = "msvisibilitychange", gw_state = "msVisibilityState") : "undefined" != typeof document.webkitHidden && (gw_hidden = "webkitHidden", gw_visibilityChange = "webkitvisibilitychange", gw_state = "webkitVisibilityState")
}(), $(function() {
    function t() {
        a || (console.log("getcount --" + (new Date).getTime()), a = !0, o.unbind("ajaxSend").unbind("ajaxComplete"), $.ajax({
            url: "",
            type: "POST",
            dataType: "json",
            success: function(t) {
                0 == t.status ? (t.msg_taskcount > 0 ? e.text(t.msg_taskcount) : parseInt(e.text()) > 0 && e.text(""), t.msg_flowtaskcount > 0 ? n.text(t.msg_flowtaskcount) : parseInt(n.text()) > 0 && n.text(""), t.msg_beappealcount > 0 ? s.text(t.msg_beappealcount) : parseInt(s.text()) > 0 && s.text(""), t.unreadnewscount > 0 ? $("#unreadnewscount").css("color", "red").text(t.unreadnewscount) : $("#unreadnewscount").css("color", "inherit").text(t.unreadnewscount)) : $.prompt(t.msg), a = !1, o.bind("ajaxSend", function() {
                    $(this).show()
                }).ajaxComplete(function() {
                    $(this).hide()
                })
            },
            error: function() {
                console.log("error")
            }
        }))
    }
    var i = $(".left-nav"),
        e = i.find(".task"),
        n = i.find(".flowtask"),
        s = i.find(".appeal"),
        o = $("#buffer"),
        a = !1;
    i.length > 0 && (t(), window.countnum = setInterval(t, 6e4)), document.addEventListener(window.gw_visibilityChange, function() {
        i.length > 0 && (document[gw_state] == gw_hidden ? clearInterval(window.countnum) : (clearInterval(window.countnum), window.countnum = setInterval(t, 6e4)))
    }, !1)
});